package com.enfo.zjabank.dao;

import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by zhoum on 2016/8/4.
 */
@Repository
public class CommentDaoImpl extends BaseDao implements CommentDao {
    @Override
    public List<Map<String, Object>> listComments(String id) {
        String sql = "select DATE_FORMAT(input_time,'%Y-%m-%d %H:%i') time,comment_des context,full_name user from buz_comment_info,org_user where input_user=user_code and object_id=?";
        Object[] params = new Object[]{id};
        return this.jdbcTemplate.queryForList(sql,params);
    }

    @Override
    public void publish(String id,String commentText,String inputUser,String inputDept,String input_time) {
        String sql = "insert into buz_comment_info(object_id,comment_des,input_user,input_dept,input_time)values(?,?,?,?,?)";
        Object[] params = new Object[]{id,commentText,inputUser,inputDept,input_time};
        this.jdbcTemplate.update(sql,params);
    }
}
